<?php

namespace App\Listeners;


class UserEventListener
{
    /**
     * 处理用户登录事件
     */
    public function onUserLogin($event) {
        echo 'I am the login lis.';
    }

    /**
     * 处理用户退出事件
     */
    public function onUserLogout($event) {
        echo 'I am the logout lis.';
    }

    /**
     * 为订阅者注册监听器
     *
     * @param  \Illuminate\Events\Dispatcher  $events
     * @return void
     */
    public function subscribe($events)
    {
        $events->listen(
            'App\Events\PodcastWasPurchased',
            'App\Listeners\UserEventListener@onUserLogin'
        );

        $events->listen(
            'App\Events\PodcastWasPurchased',
            'App\Listeners\UserEventListener@onUserLogout'
        );
    }
}